home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 26 / Cream of the Crop 26.iso / program / p063b9s.zip / UNIT / AMFBBS.PAS next >
Pascal/Delphi Source File  |  1997-03-02  |  44KB  |  1,277 lines

  1. UNIT AMFBBS;
  2. {╔══════════════════════════════════════════════════════════════════════════╗}
  3. {║ File areamanager # FilesBBSFileman            Last changed: 02.03.97  SA ║}
  4. {║                                                                          ║}
  5. {║                         (C) Copyright 1989-97 by                         ║}
  6. {║       Dan Wulff, Jens Sandalgaard, Steen Christensen & S¢ren Ager        ║}
  7. {║                                                                          ║}
  8. {║ This source may not be given to anybody, without the written permission  ║}
  9. {║ from The Portal Team.                                                    ║}
  10. {╚══════════════════════════════════════════════════════════════════════════╝}
  11. {$I POPDEFS.INC}
  12.  
  13. INTERFACE
  14.  
  15. USES Use32, AMList, AreaMisc;
  16.  
  17. TYPE
  18.   FilesbbsType = Object(Alist)
  19.     FilesBBS    : FilesBBSTab;
  20.     MemOk,
  21.     MarkedOne   : Boolean;
  22.     MaxL,
  23.     Line        : Byte;
  24.     Files       : ^FilesTab;
  25.     NumFiles,
  26.     FilesBBSNum : WORD;
  27.     All : Boolean;
  28.     OldArea     :integer;
  29.  
  30.     Constructor Init;
  31.     Destructor Done; Virtual;
  32.     FUNCTION MarkCount : Word;
  33.     PROCEDURE ShowFilesBBSLine(CONST f: FilesBBSRec; L: Integer; Current: Boolean);
  34.     PROCEDURE TotalHeader;
  35.     PROCEDURE MarkedHeader;
  36.     PROCEDURE ShowFilesInArea(fp: Integer);
  37.     PROCEDURE ScrollFilesUp;
  38.     PROCEDURE ScrollFilesDown;
  39.     PROCEDURE EditFileDescription;
  40.     PROCEDURE InsertLine;
  41.     PROCEDURE ViewGIF;
  42.     PROCEDURE RenameLine;
  43.     PROCEDURE DeleteOneLine(Ask, Del: Boolean; Num: Integer);
  44.     PROCEDURE DeleteLine(Ask: Boolean);
  45.     PROCEDURE TouchFile;
  46.     PROCEDURE MoveLine;
  47.     PROCEDURE TouchAllFiles;
  48.  
  49.     PROCEDURE ReAllignDownloadCounters(Silent: Boolean);
  50.     PROCEDURE DeleteDownloadCounters;
  51.     PROCEDURE ResetDownloadCounters;
  52.     PROCEDURE InsertDownLoadCounters(Silent: Boolean);
  53.     PROCEDURE GlobalCommands;
  54.     PROCEDURE SortFilesBBS;
  55.     PROCEDURE SendFilesToNode;
  56.     PROCEDURE HatchFiles;
  57.     PROCEDURE AreaManagerMain;
  58.  END;
  59.  
  60.  
  61. PROCEDURE Information(CONST txt : String);
  62.  
  63. IMPLEMENTATION
  64.  
  65. USES Dos, OpCrt, OpDos, OpKey, OpString, OpRoot, OpCmd, OpFrame,
  66.      OpWindow, OpEdit,
  67.      Tick , AreaMan, OutUtil, ArcView, NodeList, Input, Display,
  68.      MailUtil, FileUtil, StrUtil, OproUtil, Util, Resource,
  69.      Keyboard, PoPTypes, Globals;
  70.  
  71.   PROCEDURE AreaManagerKbdStatProc(KbdFlags: Byte); far;
  72.   VAR
  73.     s,ss:S80;
  74.   BEGIN
  75.     s:='';
  76.     ss:='';
  77.     CASE KbdFlags OF
  78.       0 : BEGIN
  79.             s:='F1=Help         F2=Delete line  F3=Edit descr.  F4=Move/Copy    F5=Rename File';
  80.             ss:='F6=Touch File   F7=Insert line  F8=Sort files   F9=View Archive F0=Global cmds';
  81.           END;
  82.     2,1 : BEGIN
  83.             s:='F1=Send files   F2=Hatch tick   F3=Center line  F4=Join lines';
  84.             ss:='                                                F9=View Picture';
  85.           END;
  86.     END;
  87.     WITH Cfg.Color[2] DO
  88.     BEGIN
  89.       FastText(CPad(s,80),ScreenHeight-1,1);
  90.       FastText(CPad(ss,80),ScreenHeight,1);
  91.     END;
  92.   END;
  93.  
  94.   PROCEDURE NewStr(VAR Sp: StringPtr; CONST s: STRING);
  95.   BEGIN
  96.     DisposeString(sp);
  97.     Sp:=StringToHeap(s);
  98.   END;
  99.  
  100.   PROCEDURE Information(CONST txt : String);
  101.   BEGIN
  102.     FastWrite(txt+charstr(' ',80-Length(txt)),ScreenHeight-2,1,cfg.color[2].TextColor);
  103.   END;
  104.  
  105.   PROCEDURE FilesbbsFindFile(A : Alistptr); { Original code provided by Steen Buch Christensen }
  106.   VAR
  107.     S : String;
  108.     NumF,FBBSNum,j,I : Word;
  109.     Found : Boolean;
  110.     Conf : Boolean;
  111.     LE   : LineEditor;
  112.     f:^FilesTab;
  113.     FBBS:^FilesBBSTab;
  114.     Temp2 : WindowPtr;
  115.   BEGIN
  116.     New(f);
  117.     New(FBBS);
  118.     S:='';
  119.     FBBSNum:=0;
  120.     IF InputString(5,8,70,50,3,'Search','Text : ',s) THEN
  121.       FOR i:= 1 TO Numarea DO
  122.       BEGIN
  123.         If GotEsc then break;
  124.         IF ReadFilesInArea(Area^[i]^.FPath^,4,F^,FBBS^,FBBSNum,NumF,I) THEN
  125.         BEGIN
  126.           s:=StUpCase(s);
  127.           Found:=FALSE;
  128.           FOR j:=1 TO FBBSNum DO
  129.           BEGIN
  130.             IF POS(s,StUpCase(FBBS^[j]^.tekst^))<>0 THEN
  131.             BEGIN
  132.               MyWin(Temp2,3,8,78,12,4,'Found...',False);
  133.               Temp2^.wFastWrite('Area: ('+Area^[i]^.tag^+') '+Area^[i]^.title^,1,2,Cfg.Color[4].HighLightColor);
  134.               Temp2^.wFastWrite('File: '+Trim(COPY(FBBS^[j]^.Tekst^,1,12)),2,2,Cfg.Color[4].HighLightColor);
  135.               Temp2^.wFastWrite('Desc: '+Trim(COPY(FBBS^[j]^.Tekst^,13,80)),3,2,Cfg.Color[4].HighLightColor);
  136. {             Temp^.wFastWrite('Continue search [Y/N] ? ',5,2,Cfg.Color[4].HighLightColor);
  137.               LE.Init(Cfg.Color[4]);
  138.               Conf:=LE.YesOrNo('Continue search [Y/N] ? ',5,2,'Y'); }
  139.               Conf := Confirm('Continue search ?','N',14);
  140.               KillWindow(Temp2);
  141.               If not Conf THEN
  142.               BEGIN
  143.                 Found:=True;
  144.                 Break;
  145.               END;
  146.             END;
  147.           END;
  148.           IF Found THEN
  149.           BEGIN
  150.             StuffKey(Enter);
  151.             A^.TopArea:=i-1;
  152.             A^.AreaLine:=1;
  153.             A^.StartLine:=j-1;
  154.             Break;
  155.           END;
  156.         END;
  157.       END;
  158.     DeAllocateFiles(FBBS^,FBBSNum);
  159.     Dispose(f);
  160.     Dispose(FBBS);
  161.   END;
  162.  
  163. {=== FilesbbsType ===}
  164.  
  165.  
  166.   CONSTRUCTOR FilesbbsType.Init;
  167.   BEGIN
  168.     InitAreaManager;
  169.     MarkedOne:=FALSE;
  170.     NumFiles:=0;
  171.     FilesBBSNum:=0;
  172.     Filefinder := FilesbbsFindFile;
  173. {   MyWin(MainFuncKeyWin,1,ScreenHeight-2,80,ScreenHeight,2,'',False); }
  174.     FileMgrWin^.WFrame.AddHeader('',heBL);
  175.     FileMgrWin^.WFrame.AddHeader('',heBR);
  176.     FileMgrWin^.WFrame.DrawHeader(1);
  177.     FileMgrWin^.WFrame.DrawHeader(2);
  178.     New(Files);
  179.     FillChar(Files^,SizeOf(FilesTab),0);
  180.   END;
  181.  
  182.   DESTRUCTOR FilesbbsType.Done;
  183.   BEGIN
  184.     Dispose(Files);
  185.     DeAllocateFiles(FilesBBS,FilesBBSNum);
  186.     FinishAreaManager;
  187.   END;
  188.  
  189.   FUNCTION FilesbbsType.MarkCount : Word;
  190.   VAR
  191.     i,j:Word;
  192.   BEGIN
  193.     i:=0;
  194.     FOR j:=1 TO FilesBBSNum DO
  195.       IF FilesBBS[j]^.Mark THEN Inc(i);
  196.     MarkCount:=i;
  197.   END;
  198.  
  199.  
  200.   PROCEDURE FilesbbsType.ShowFilesBBSLine(CONST f: FilesBBSRec; L: Integer; Current: Boolean);
  201.   VAR
  202.     j,i        : Integer;
  203.     Dt         : DateTime;
  204.     linetoshow : S78;
  205.     s          : String;
  206.   BEGIN
  207.     j:=GetFileInfo(f.Tekst^,Files^,NumFiles);
  208.     linetoshow:=f.Tekst^;
  209.     s:=f.Tekst^+' ';
  210.     IF HasFileName(s) THEN
  211.     BEGIN
  212.       IF j<>0 THEN
  213.       BEGIN
  214.         WITH Files^[j] DO
  215.         BEGIN
  216.           UnPackTime(Time,Dt);
  217.           linetoshow:=Name+charstr(' ',13-Length(Name))+tochar(Dt.Day)+'/' +
  218.           tochar(Dt.Month)+'-'+tochar(Dt.Year MOD 100)+LongIntForm('########',size);
  219.         END;
  220.         s:=f.Tekst^+' ';
  221.         Delete(s,1,pos(' ',s));
  222.         i:=0;
  223.         REPEAT
  224.           Inc(i);
  225.         UNTIL (s[i]<>' ') OR (i>Length(s));
  226.         Delete(s,1,i-1);
  227.         linetoshow:=linetoshow+' '+s;
  228.       END ELSE
  229.       BEGIN
  230.         linetoshow:=f.Tekst^;
  231.         IF Length(f.Tekst^)<13 THEN linetoshow:=linetoshow+charstr(' ',13-Length(f.Tekst^));
  232.         Insert('     MISSING     ',linetoshow,14);
  233.       END;
  234.     END;
  235.     linetoshow:=linetoshow+charstr(' ',78);
  236.     j:=FirstShown+L;
  237.     FileMgrWin^.wFastWrite(linetoshow,L,1,CorrectAttribute(2,Current,f.Mark));
  238.   END;
  239.  
  240.   PROCEDURE FilesbbsType.TotalHeader;
  241.   VAR
  242.     Redraw:Boolean;
  243.     TotalBytes:LONGINT;
  244.     i:Word;
  245.   BEGIN
  246.     TotalBytes:=0;
  247.     FOR i:=1 TO NumFiles DO
  248.       Inc(TotalBytes,Files^[i].Size);
  249.     FileMgrWin^.wFrame.ChangeHeaderString(1,' Files '+LongIntForm('####',NumFiles)+
  250.                                                 ' Bytes : '+LongIntForm('###,###,###',TotalBytes)+' ',ReDraw);
  251.     IF ReDraw THEN FileMgrWin^.wFrame.UpDateFrame ELSE FileMgrWin^.wFrame.DrawHeader(1);
  252.   END;
  253.  
  254.   PROCEDURE FilesbbsType.MarkedHeader;
  255.   VAR
  256.     Redraw:Boolean;
  257.     TotalBytes:LONGINT;
  258.     i,j:Word;
  259.   BEGIN
  260.     TotalBytes:=0;
  261.     FOR i:=1 TO FilesBBSNum DO
  262.       IF FilesBBS[i]^.Mark THEN
  263.       BEGIN
  264.         j:=GetFileInfo(FilesBBS[i]^.Tekst^,Files^,NumFiles);
  265.         IF j>0 THEN Inc(TotalBytes,Files^[j].Size);
  266.       END;
  267.     FileMgrWin^.wFrame.ChangeHeaderString(2,' Marked Lines '+LongIntForm('####',MarkCount)+
  268.                                                 ' Bytes : '+LongIntForm('###,###,###',TotalBytes)+' ',ReDraw);
  269.     IF ReDraw THEN FileMgrWin^.wFrame.UpDateFrame ELSE FileMgrWin^.wFrame.DrawHeader(2);
  270.   END;
  271.  
  272.   PROCEDURE FilesbbsType.ShowFilesInArea(fp: Integer);
  273.   VAR
  274.     f,i : Integer;
  275.   BEGIN
  276.     FileMgrWin^.Clear;
  277.     f:=fp;
  278.     IF (f<0) OR (FilesBBSNum<0) THEN
  279.     BEGIN
  280.       f:=0;
  281.       FilesBBSNum:=0;
  282.       Line:=0;
  283.     END;
  284.     FirstShown:=f;
  285.     i:=0;
  286.     WHILE (i<ScreenHeight-6) AND (f+i<FilesBBSNum) DO
  287.     BEGIN
  288.       Inc(i);
  289.       ShowFilesBBSLine(FilesBBS[i+f]^,i,FALSE);
  290.     END;
  291.     MaxL:=i;
  292.     IF Line>MaxL THEN Line:=MaxL;
  293.     IF (Line<1) AND (MaxL>0) THEN Line:=1;
  294.     TotalHeader;
  295.     MarkedHeader;
  296.   END;
  297.  
  298.   PROCEDURE FilesbbsType.ScrollFilesUp;
  299.   BEGIN
  300.     IF FirstShown+ScreenHeight-6<=FilesBBSNum THEN
  301.     BEGIN
  302.       Inc(FirstShown);
  303.       FileMgrWin^.ScrollVert(1);
  304.       IF MaxL=ScreenHeight-6 THEN
  305.       BEGIN
  306.         ShowFilesBBSLine(FilesBBS[FirstShown+ScreenHeight-6]^,ScreenHeight-6,True);
  307.       END;
  308.     END;
  309.   END;
  310.  
  311.   PROCEDURE FilesbbsType.ScrollFilesDown;
  312.   BEGIN
  313.     IF FirstShown>0 THEN
  314.     BEGIN
  315.       Dec(FirstShown);
  316.       FileMgrWin^.Scrollvert(-1);
  317.       ShowFilesBBSLine(FilesBBS[FirstShown+1]^,1,True);
  318.     END;
  319.   END;
  320.  
  321.   PROCEDURE FilesbbsType.EditFileDescription;
  322.   VAR
  323.     i,j     : Integer;
  324.     s,ss    : String;
  325.   BEGIN
  326.     s:=FilesBBS[FirstShown+Line]^.Tekst^;
  327.     j:=GetFileInfo(s,Files^,NumFiles);
  328.     ss:='';
  329.     IF HasFileName(s) THEN
  330.     BEGIN
  331.       i:=1;
  332.       WHILE (s[i]<>' ') AND (Length(s) >=i) DO
  333.         Inc(i);
  334.       WHILE (s[i]=' ') AND (Length(s) >=i) DO
  335.         Inc(i);
  336.       ss:=Copy(s,1,i-1);
  337.       Delete(s,1,i-1);
  338.       IF ss<>'' THEN ss:=ss+charstr(' ',13-Length(ss));
  339.     END;
  340.     IF InputString(3,7,250,65,3,'Edit description','Desc : ',s) THEN
  341.     BEGIN
  342.       ss:=ss+s;
  343.       NewStr(FilesBBS[FirstShown+Line]^.Tekst,ss);
  344.     END;
  345.     ShowFilesBBSLine(FilesBBS[FirstShown+Line]^,Line,True);
  346.   END;
  347.  
  348.   PROCEDURE FilesbbsType.InsertLine;
  349.   VAR
  350.     i,j : Integer;
  351.     m   : TPoPMenu;
  352.     ec,
  353.     key : Word;
  354.   BEGIN
  355.     BEGIN
  356.       IF FilesBBSNum>0 THEN
  357.       BEGIN
  358.         GetMenu(MnuAMInsertLine,3,m);
  359.         m.ProcessMenu(Key, ec);
  360.       END ELSE
  361.         ec:=ccNone;
  362.       IF ec<>ccQuit THEN
  363.       BEGIN
  364.         j:=1;
  365.         Inc(FilesBBSNum);
  366.         New(FilesBBS[FilesBBSNum]);
  367.         IF FilesBBSNum>1 THEN
  368.         BEGIN
  369.           IF key=1 THEN j:=0 ELSE j:=1;
  370.           FOR i:=FilesBBSNum-1 DOWNTO FirstShown+Line+j DO
  371.             FilesBBS[i+1]^:=FilesBBS[i]^;
  372.         END;
  373.         FilesBBS[FirstShown+Line+j]^.Tekst:=StringToHeap('');
  374.         FilesBBS[FirstShown+Line+j]^.Mark:=False;
  375.         IF FirstShown>FilesBBSNum THEN FirstShown:=FilesBBSNum;
  376.         ShowFilesInArea(FirstShown);
  377.       END;
  378.     END;
  379.   END;
  380.  
  381.   PROCEDURE FilesbbsType.ViewGIF;
  382.   Var
  383.     s         : S13;
  384.     ss        : String;
  385.   BEGIN
  386.     BEGIN
  387.       s:=FilesBBS[FirstShown+Line]^.Tekst^+' ';
  388.       s:=Copy(s,1,pos(' ',s)-1);
  389.       If (s<>'') and (TrimSpaces(Cfg.AreaMan.ViewCMD)<>'') THEN
  390.       BEGIN
  391.         Ss:=Cfg.AreaMan.ViewCMD;
  392.         Replace(ss,'$filename',s,0);
  393.         RunCmd(ss,'');
  394.       END;
  395.     END;
  396.   END;
  397.  
  398.   PROCEDURE FilesbbsType.RenameLine;
  399.   VAR
  400.     s,ss    : S13;
  401.     Tmp     : STRING;
  402.     i,j     : Integer;
  403.     f       : FILE;
  404.   BEGIN
  405.     BEGIN
  406.       s:=FilesBBS[FirstShown+Line]^.Tekst^+' ';
  407.       s:=Copy(s,1,pos(' ',s)-1);
  408.       ss:=s;
  409.       IF s<>'' THEN
  410.       BEGIN
  411.         IF InputString(30,8,12,12,3,'Rename file','FileName : ',s) AND (s<>ss) THEN
  412.         BEGIN
  413.           s:=StUpCase(s);
  414.           j:=GetFileInfo(s,Files^,NumFiles);
  415.           Assign(f,ss); Rename(f,s);
  416.           IF IoResult=0 THEN
  417.           BEGIN
  418.             i:=GetFileInfo(ss,Files^,NumFiles);
  419.             IF i<>0 THEN Files^[i].Name:=s;
  420.           END;
  421.           Tmp:=FilesBBS[FirstShown+Line]^.Tekst^;
  422.           Delete(Tmp,1,Length(ss));
  423.           Insert(s,Tmp,1);
  424.           IF Length(s)<Length(ss) THEN
  425.           BEGIN
  426.             i:=Length(ss)-Length(s);
  427.             Insert(charstr(' ',i),Tmp,Length(s)+1);
  428.           END
  429.           ELSE
  430.             IF Length(s)>Length(ss) THEN
  431.             BEGIN
  432.               i:=Length(s)-Length(ss);
  433.               Delete(Tmp,Length(s)+1,i);
  434.             END;
  435.           NewStr(FilesBBS[FirstShown+Line]^.Tekst,Tmp);
  436.           SorterFiles(Files^,NumFiles);
  437.           ShowFilesBBSLine(FilesBBS[FirstShown+Line]^,Line,True);
  438.         END;
  439.       END
  440.       ELSE
  441.       BEGIN
  442.         AskError(8,'This line does NOT contain a file name',3);
  443.       END;
  444.     END;
  445.   END;
  446.  
  447.   PROCEDURE FilesbbsType.DeleteOneLine(Ask, Del: Boolean; Num: Integer);
  448.   VAR
  449.     i:Integer;
  450.     s:STRING;
  451.     sr:SEARCHREC;
  452.     d:Boolean;
  453.   BEGIN
  454.     d:=Del;
  455.     BEGIN
  456.       s:=FilesBBS[num]^.Tekst^+' ';
  457.       s:=Copy(s,1,pos(' ',s)-1);
  458.       DisposeString(FilesBBS[num]^.Tekst);
  459.       FOR i:=num TO FilesBBSNum-1 DO
  460.         FilesBBS[i]^:=FilesBBS[i+1]^;
  461.       Dispose(FilesBBS[FilesBBSNum]);
  462.       Dec(FilesBBSNum);
  463.       IF s<>'' THEN
  464.       BEGIN
  465.         i:=GetFileInfo(s,Files^,NumFiles);
  466.         IF i<>0 THEN
  467.         BEGIN
  468.           IF WritableFile(Area^[CurrentArea]^.Path^+s) THEN
  469.           BEGIN
  470.             IF All THEN d:=TRUE ELSE
  471.               IF Ask THEN
  472.               BEGIN
  473.                 CASE ConfirmAll(' Delete '+s+' also?',6) OF
  474.                   'Y' : d:=TRUE;
  475.                   'N' : d:=FALSE;
  476.                   'A' : BEGIN
  477.                           All:=TRUE;
  478.                           d:=TRUE;
  479.                         END;
  480.                 END;
  481.               END;
  482.             IF D THEN
  483.             BEGIN
  484.               FINDFIRST(s,archive,sr);
  485.               WHILE DOSERROR=0 DO
  486.               BEGIN
  487.                 DeleteFile(sr.Name);
  488.                 FINDNEXT(sr);
  489.               END;
  490.               FindClose(sr);
  491.               Move(Files^[i+1],Files^[i],SizeOf(FilesRec)*(NumFiles-i));
  492.               Dec(NumFiles);
  493.             END;
  494.           END;
  495.         END;
  496.       END;
  497.     END;
  498.   END;
  499.  
  500.   PROCEDURE FilesbbsType.DeleteLine(Ask: Boolean);
  501.   VAR
  502.     j   : Integer;
  503.     Del : Boolean;
  504.   BEGIN
  505.     BEGIN
  506.       Del:=NOT Ask;
  507.       IF Ask THEN
  508.         IF MarkCount=0 THEN Del:=Confirm('Delete current line','Y',5)
  509.                        ELSE Del:=Confirm('Delete MARKED lines','N',5);
  510.       IF Del THEN
  511.       BEGIN
  512.         IF MarkCount=0 THEN FilesBBS[FirstShown+Line]^.Mark:=True;
  513.         j:=1;
  514.         All:=FALSE;
  515.         REPEAT
  516.           IF FilesBBS[j]^.Mark THEN
  517.           BEGIN
  518.             DeleteOneLine(Ask,Del,j);
  519.           END ELSE Inc(j);
  520.         UNTIL j>FilesBBSNum;
  521.         IF FirstShown>=FilesBBSNum THEN FirstShown:=FilesBBSNum-1;
  522.         ShowFilesInArea(FirstShown);
  523.         IF Line>MaxL THEN Line:=MaxL;
  524.       END;
  525.     END;
  526.   END;
  527.  
  528.   PROCEDURE FilesbbsType.TouchFile;
  529.   VAR
  530.     l      : LongInt;
  531.     Sec100,
  532.     dofw,i : Word;
  533.     s      : String;
  534.     Dt     : DateTime;
  535.     f      : FILE;
  536.   BEGIN
  537.     BEGIN
  538.       IF MarkCount=0 THEN FilesBBS[FirstShown+Line]^.Mark:=True;
  539.       FOR i:=1 TO FilesBBSNum DO
  540.         IF FilesBBS[i]^.Mark AND HasFileName(FilesBBS[i]^.Tekst^) THEN
  541.         BEGIN
  542.           s:=FilesBBS[i]^.Tekst^+' ';
  543.           s:=Copy(s,1,pos(' ',s)-1);
  544.           IF s<>'' THEN
  545.           BEGIN
  546.             WITH Dt DO
  547.             BEGIN
  548.               GetTime(Hour,Min,Sec,Sec100);
  549.               GetDate(Year,Month,Day,dofw);
  550.             END;
  551.             packtime(Dt,l);
  552.             Assign(f,s); FileMode:=ShareRead+ShareDenyW; Reset(f);
  553.             IF IoResult=0 THEN
  554.             BEGIN
  555.               dofw:=GetFileInfo(s,Files^,NumFiles);
  556.               IF dofw<>0 THEN Files^[dofw].Time:=l;
  557.               SetFTime(f,l); Close(f);
  558.             END;
  559.           END;
  560.         END;
  561.       IF MarkCount=1 THEN
  562.       BEGIN
  563.         FilesBBS[FirstShown+Line]^.Mark:=False;
  564.         ShowFilesBBSLine(FilesBBS[FirstShown+Line]^,Line,True);
  565.       END;
  566.       ShowFilesInArea(FirstShown);
  567.     END;
  568.   END;
  569.  
  570.   PROCEDURE FilesbbsType.MoveLine;
  571.   VAR
  572.     m   : TPoPMenu;
  573.     key : Word;
  574.  
  575.     PROCEDURE InitMenu(VAR m : TPoPMenu);
  576.     VAR
  577.       sd:CHAR;
  578.     BEGIN
  579.       GetMenu(MnuAMMoveFile,3,m);
  580.       IF GetDiskClass(Area^[CurrentArea]^.Path^[1],sd)=CDRomDisk THEN
  581.       BEGIN
  582.         m.ProtectItem(1);
  583.         m.ProtectItem(2);
  584.       END;
  585.       IF (MarkCount>1) OR
  586.          (GetDiskClass(Area^[CurrentArea]^.FPath^[1],sd)=CDRomDisk) THEN m.ProtectItem(5);
  587.       m.Draw;
  588.     END;
  589.  
  590.     PROCEDURE MoveFileToOtherArea(Keep, InFileArea: Boolean);
  591.     LABEL
  592.       Slut, Skip, DoTheMove, MoveTheText;
  593.     VAR
  594.       Go, All        : BOOLEAN;
  595.       OldAreaLine,
  596.       OldTopArea, j  : Integer;
  597.       GemTekst, Fp,
  598.       s,ss, DestPath : String;
  599.       testfile       : FILE;
  600.       f              : TBufTextFile;
  601.       Escaped        : Boolean;
  602.       M              : TPoPMenu;
  603.       Key, Inkey     : Word;
  604.  
  605.       procedure InitMenu(var M : TPoPMenu);
  606.       begin
  607.         GetMenu(MnuCopyFileError,3,m);
  608.         M.WFrame.AddHeader(' '+ss+' ',heTC);
  609.         m.Draw;
  610.       end;
  611.  
  612.     BEGIN
  613.       BEGIN
  614.         j:=1;
  615.         OldArea:=CurrentArea;
  616.         OldTopArea:=TopArea;
  617.         OldAreaLine:=AreaLine;
  618.         IF InFileArea THEN
  619.         BEGIN
  620.           Escaped:=NOT ChooseFileArea(InKey);
  621.           DestPath:=Area^[CurrentArea]^.Path^;
  622.           AreaLine:=OldAreaLine;
  623.           TopArea:=OldTopArea;
  624.           ChangeDir(Area^[OldArea]^.path^);
  625.           IF Escaped THEN GOTO Slut;
  626.         END ELSE
  627.         BEGIN
  628.           DestPath:='A:';
  629.           IF NOT SelectPath(DestPath) THEN GOTO Slut;
  630.         END;
  631.         IF ((CurrentArea<>OldArea) OR NOT InFileArea) THEN
  632.         BEGIN
  633.           IF MarkCount=0 THEN
  634.           BEGIN
  635.             FilesBBS[FirstShown+Line]^.Mark:=True;
  636.             MarkedOne:=True;
  637.           END ELSE MarkedOne:=FALSE;
  638.           IF InFileArea THEN Fp:=Area^[CurrentArea]^.FPath^ ELSE Fp:=AddBackSlash(DestPath)+'FILES.BBS';
  639.           f.InitCreate(Fp, SOpenWrite, 2048);
  640.           All:=FALSE;
  641.           REPEAT
  642.             IF FilesBBS[j]^.Mark THEN
  643.             BEGIN
  644.               GemTekst:=FilesBBS[j]^.Tekst^;
  645.               s:=GemTekst+' ';
  646.               s:=Copy(s,1,pos(' ',s)-1);
  647.               IF ExistFile(AddBackSlash(DestPath)+s) THEN
  648.               BEGIN
  649.                 IF NOT All THEN
  650.                 BEGIN
  651.                   CASE ConfirmAll('Overwrite existing file "'+s+'" ?',8) OF
  652.                     'Y' : Go:=TRUE;
  653.                     'N' : Go:=FALSE;
  654.                     'A' : BEGIN
  655.                             Go:=TRUE;
  656.                             All:=TRUE;
  657.                           END;
  658.                   END;
  659.                 END;
  660.                 IF Go THEN GOTO DoTheMove ELSE FilesBBS[j]^.Mark:=FALSE;
  661.               END ELSE
  662.               BEGIN
  663. DoTheMove:
  664.                 IF (Copy(Area^[OldArea]^.path^,1,1)=COPY(DestPath,1,1)) AND Not Keep THEN
  665.                 BEGIN
  666.                   {Assign(TestFile,AddBackSlash(DestPath)+s); Erase(TestFile);}
  667.                   Deletefile(AddBackSlash(DestPath)+s);
  668.                   InOutRes:=0; io:=0;
  669.                   Assign(TestFile,Area^[OldArea]^.path^+s); Rename(TestFile,AddBackSlash(DestPath)+s);
  670.                   IF IoResult=0 THEN GOTO MoveTheText;
  671.                 END
  672.                 ELSE
  673.                 BEGIN
  674.                   IF HasFileName(s) AND ExistFile(Area^[OldArea]^.Path^+s) THEN
  675.                     Io:=CopyFile(Area^[OldArea]^.path^+s,AddBackSlash(DestPath)+s,False,False)
  676.                   ELSE io:=0;
  677.                 END;
  678.                 IF io=0 THEN
  679.                 BEGIN
  680. MoveTheText:
  681.                   f.WriteLn(GemTekst);
  682.                   IF Not Keep THEN DeleteOneLine(False,True,j);
  683.                 END ELSE
  684.                 BEGIN
  685.                   f.Done;
  686.                   CASE io OF
  687.                       5 : ss:='No Room for '+JustFileName(s);
  688.                     152 : ss:='Drive not ready';
  689.                     162 : ss:='General failure';
  690.                     ELSE  ss:='Unknown error #'+Long2Str(io);
  691.                   END;
  692.                   InitMenu(M);
  693.                   m.Process;
  694.                   Key := m.MenuChoice;
  695.                   IF m.GetLastCommand=ccQuit THEN Key:=2;
  696.                   m.Done;
  697.                   CASE Key OF
  698.                     1 : BEGIN
  699.                           f.InitCreate(Fp, SOpenWrite, 2048);
  700.                           GOTO DoTheMove;
  701.                         END;
  702.                     2 : GOTO Slut;
  703.                     3 : GOTO Skip;
  704.                   END;
  705.                 END;
  706.               END;
  707. Skip:
  708.               IF Keep OR (io=5) THEN Inc(j);
  709.             END ELSE
  710.               Inc(j);
  711.           UNTIL j>FilesBBSNum;
  712.           f.Done;
  713. Slut:
  714.           IF MarkedOne AND (MarkCount=1) THEN FilesBBS[FirstShown+Line]^.Mark:=FALSE;
  715.           ShowFilesInArea(FirstShown);
  716.         END;
  717.         IF InFileArea THEN CurrentArea:=OldArea;
  718.       END;
  719.     END;
  720.  
  721.   BEGIN
  722.     InitMenu(m);
  723.     m.Process;
  724.     key:=m.MenuChoice;
  725.     m.Erase;
  726.     IF m.GetLastCommand<>ccQuit THEN
  727.     BEGIN
  728.       CASE key OF
  729.      1..4 : MoveFileToOtherArea(Key IN [3,4],Key IN [1,3]);
  730.         5 : BEGIN
  731.               movemode:=True;
  732.               Information('MOVE MODE: F-Keys disabled. Hit RETURN to finish.');
  733.             END;
  734.       END;
  735.     END;
  736.     m.Done;
  737.   END;
  738.  
  739.   PROCEDURE FilesbbsType.TouchAllFiles;
  740.   VAR
  741.     f      : FILE;
  742.     i      : Integer;
  743.     l      : LongInt;
  744.     Dt     : DateTime;
  745.     Sec100,
  746.     dofw   : Word;
  747.   BEGIN
  748.     IF Confirm('Touch ALL files >','Y',5) THEN
  749.     BEGIN
  750.       WITH Dt DO
  751.       BEGIN
  752.         GetTime(Hour,Min,Sec,Sec100);
  753.         GetDate(Year,Month,Day,dofw);
  754.       END;
  755.       packtime(Dt,l);
  756.       FOR i:=1 TO NumFiles DO
  757.       BEGIN
  758.         Files^[i].Time:=l;
  759.         Assign(f,Files^[i].Name); FileMode:=ShareRead+ShareDenyW;
  760.         Reset(f);
  761.         SetFTime(f,l);
  762.         Close(f);
  763.       END;
  764.       ShowFilesInArea(FirstShown);
  765.     END;
  766.   END;
  767.  
  768.   PROCEDURE FilesbbsType.ReAllignDownloadCounters(Silent: Boolean);
  769.   VAR
  770.     s          : String;
  771.     HadOne     : Boolean;
  772.     i,j,test,x : Integer;
  773.   BEGIN
  774.       IF (Cfg.AreaMan.DLCntStart>' ') AND (Cfg.AreaMan.DLCntStop>' ') THEN
  775.       BEGIN
  776.         IF Silent OR Confirm('Re-align download counters in this area','Y',8) THEN
  777.         BEGIN
  778.           FOR x:=1 TO FilesBBSNum DO
  779.           BEGIN
  780.             s:=FilesBBS[x]^.Tekst^;
  781.             HadOne:=(GetDlC(s)>0) OR Cfg.AreaMan.InsDLCnt;
  782.             AddDlC(s);
  783.             IF NOT HadOne THEN DelDlC(s);
  784.             NewStr(FilesBBS[x]^.Tekst,s);
  785.           END;
  786.           IF NOT Silent THEN ShowFilesInArea(FirstShown);
  787.         END;
  788.       END ELSE
  789.         IF NOT Silent THEN AskError(8,'Download Counters NOT defined',3);
  790.   END;
  791.  
  792.   PROCEDURE FilesbbsType.DeleteDownloadCounters;
  793.   VAR
  794.     s          : String;
  795.     i,j,test,x : Integer;
  796.   BEGIN
  797.     BEGIN
  798.       IF (Cfg.AreaMan.DLCntStart>' ') AND (Cfg.AreaMan.DLCntStop>' ') THEN
  799.       BEGIN
  800.         IF Confirm('Delete ALL download counters in this area','N',8) THEN
  801.         BEGIN
  802.           FOR x:=1 TO FilesBBSNum DO
  803.           BEGIN
  804.             s:=FilesBBS[x]^.Tekst^;
  805.             DelDlC(s);
  806.             NewStr(FilesBBS[x]^.Tekst,s);
  807.           END;
  808.           ShowFilesInArea(FirstShown);
  809.         END;
  810.       END ELSE
  811.         AskError(8,'Download Counters NOT defined',3);
  812.     END;
  813.   END;
  814.  
  815.   PROCEDURE FilesbbsType.ResetDownloadCounters;
  816.   VAR
  817.     s          : String;
  818.     i,j,test,x : Integer;
  819.   BEGIN
  820.     BEGIN
  821.       IF (Cfg.AreaMan.DLCntStart>#32) AND (Cfg.AreaMan.DLCntStop>#32) THEN
  822.       BEGIN
  823.         IF Confirm('Reset ALL download counters in this area','N',8) THEN
  824.         BEGIN
  825.           FOR x:=1 TO FilesBBSNum DO
  826.           BEGIN
  827.             s:=FilesBBS[x]^.Tekst^;
  828.             ZeroDlC(s);
  829.             NewStr(FilesBBS[x]^.Tekst,s);
  830.           END;
  831.           ShowFilesInArea(FirstShown);
  832.         END;
  833.       END ELSE
  834.         AskError(8,'Download Counters NOT defined',3);
  835.     END;
  836.   END;
  837.  
  838.   PROCEDURE FilesbbsType.InsertDownLoadCounters(Silent: Boolean);
  839.   VAR
  840.     s : String;
  841.     x : Integer;
  842.   BEGIN
  843.     BEGIN
  844.       IF (Cfg.AreaMan.DLCntStart>#32) AND (Cfg.AreaMan.DLCntStop>#32) THEN
  845.       BEGIN
  846.         IF Silent OR Confirm('Insert missing download counters in this area','Y',8) THEN
  847.         BEGIN
  848.           FOR x:=1 TO FilesBBSNum DO
  849.           BEGIN
  850.             s:=FilesBBS[x]^.Tekst^;
  851.             AddDlC(s);
  852.             NewStr(FilesBBS[x]^.Tekst,s);
  853.           END;
  854.           IF NOT Silent THEN ShowFilesInArea(FirstShown);
  855.         END;
  856.       END ELSE
  857.         IF NOT Silent THEN AskError(8,'Download Counters NOT defined',3);
  858.     END;
  859.   END;
  860.  
  861.   PROCEDURE FilesbbsType.GlobalCommands;
  862.   VAR
  863.     m       : TPoPMenu;
  864.     key,
  865.     LastCmd : Word;
  866.   BEGIN
  867.     IF NOT WritableFile(Area^[CurrentArea]^.Path^) AND
  868.        NOT WritableFile(Area^[CurrentArea]^.FPath^) THEN
  869.       EXIT;
  870.     GetMenu(MnuAMGlobalFunc,3,m);
  871.     IF NOT WritableFile(Area^[CurrentArea]^.FPath^) THEN
  872.     BEGIN
  873.       FOR LastCmd:=1 TO 6 DO
  874.         IF NOT (LastCmd<>2) THEN m.ProtectItem(LastCmd);
  875.     END;
  876.     IF NOT WritableFile(Area^[CurrentArea]^.Path^) THEN m.ProtectItem(2);
  877.     m.ProcessMenu(Key, LastCmd);
  878.     IF LastCmd<>ccQuit THEN
  879.     BEGIN
  880.       CASE key OF
  881.         1 : BEGIN
  882.               AdoptOrphans(FALSE,True,FilesBBS,Files^,NumFiles,FilesBBSNum,'');
  883.               IF Cfg.AreaMan.InsDLCnt THEN InsertDownLoadCounters(True);
  884.                 ShowFilesInArea(0);
  885.             END;
  886.         2 : TouchAllFiles;
  887.         3 : DeleteDownloadCounters;
  888.         4 : ResetDownloadCounters;
  889.         5 : InsertDownLoadCounters(FALSE);
  890.         6 : ReAllignDownloadCounters(FALSE);
  891.       END;
  892.     END;
  893.   END;
  894.  
  895.   PROCEDURE FilesbbsType.SortFilesBBS;
  896.   VAR
  897.     num,bufsiz,
  898.     First, Last,
  899.     i, j        : Word;
  900.     f           : TBufTextFile;
  901.     s,LastUsed,Smallest : S13;
  902.   BEGIN
  903.     BEGIN
  904.       IF MarkCount=2 THEN
  905.       BEGIN
  906.         i:=1;
  907.         WHILE NOT FilesBBS[i]^.Mark DO
  908.           Inc(i);
  909.         IF NOT HasFileName(FilesBBS[i]^.Tekst^) THEN
  910.         BEGIN
  911.           AskError(8,'First line MUST contain a file name',3);
  912.           EXIT;
  913.         END;
  914.         IF MaxAvail>32768 THEN bufsiz:=32768 ELSE bufsiz:=MaxAvail;
  915.         f.Init(JustPathName(Area^[CurrentArea]^.FPath^)+'\PORTAL.$$$', SCreate, BufSiz);
  916.         i:=1;
  917.         WHILE NOT FilesBBS[i]^.Mark DO
  918.         BEGIN
  919.           f.WriteLn(FilesBBS[i]^.Tekst^);
  920.           Inc(i);
  921.         END;
  922.         LastUsed:='';
  923.         First:=i;
  924.         Last:=i+1;
  925.         WHILE NOT FilesBBS[Last]^.Mark DO
  926.           Inc(Last);
  927.         FOR i:=First TO Last DO
  928.         BEGIN
  929.           Smallest:=charstr(#255,13);
  930.           FOR j:=First TO Last DO
  931.           BEGIN
  932.             IF HasFileName(FilesBBS[j]^.Tekst^) THEN
  933.             BEGIN
  934.               s:=Copy(FilesBBS[j]^.Tekst^,1,13);
  935.               IF (s>LastUsed) AND (s<Smallest) THEN
  936.               BEGIN
  937.                 Smallest:=s;
  938.                 num:=j;
  939.               END;
  940.             END;
  941.           END;
  942.           IF Smallest<charstr(#255,13) THEN
  943.           BEGIN
  944.             LastUsed:=Smallest;
  945.             j:=num;
  946.             REPEAT
  947.               f.WriteLn(FilesBBS[j]^.Tekst^);
  948.               Inc(j);
  949.             UNTIL (j>Last) OR HasFileName(FilesBBS[j]^.Tekst^);
  950.           END;
  951.         END;
  952.  
  953.         FOR i:=Last+1 TO FilesBBSNum DO
  954.           f.WriteLn(FilesBBS[i]^.Tekst^);
  955.         f.Done;
  956.         IF DeleteFile(Area^[CurrentArea]^.FPath^) THEN
  957.           IF RenameFile(JustPathName(Area^[CurrentArea]^.FPath^)+'\PORTAL.$$$',Area^[CurrentArea]^.FPath^) THEN
  958.             MemOk:=ReadFilesInArea(Area^[CurrentArea]^.FPath^,4,
  959.                                    Files^,FilesBBS,FilesBBSNum,NumFiles,0);
  960.       END;
  961.       Information('');
  962.       IF MemOk THEN ShowFilesInArea(FirstShown);
  963.     END;
  964.   END;
  965.  
  966.   PROCEDURE FilesbbsType.SendFilesToNode;
  967.   VAR
  968.     ch:Char;
  969.     m:Byte;
  970.     Escaped:Boolean;
  971.     i : Integer;
  972.     SendAddress: TFidoAddress;
  973.     s : STRING;
  974.   BEGIN
  975.     BEGIN
  976.       FillChar(SendAddress, SizeOf(SendAddress), 0);
  977.       IF MarkCount=0 THEN FilesBBS[FirstShown+Line]^.Mark:=True;
  978.       NodeListPathStr:=#255;
  979.       InitialiseNodeList(Cfg.NodeList,Cfg.NodeListTyp);
  980.       IF GetConfirmAddress(3,4,SendAddress,1503) THEN
  981.       BEGIN
  982.         m:=SelectMailType(Escaped,1550);
  983.         IF NOT Escaped THEN
  984.         BEGIN
  985.           ExtFlags[1]:='H';
  986.           ExtFlags[3]:='F';
  987.           ch:=ExtFlags[m];
  988.           FOR i:=1 TO FilesBBSNum DO
  989.             WITH FilesBBS[i]^ DO
  990.               IF Mark AND HasFileName(Tekst^) THEN
  991.               BEGIN
  992.                 s:=Tekst^+' ';
  993.                 SendAFile(Area^[CurrentArea]^.Path^+COPY(s,1,POS(' ',s)-1),SendAddress,ch,STNothing);
  994.               END;
  995.         END;
  996.       END;
  997.       FreeUpMemory;
  998.       IF MarkCount=1 THEN FilesBBS[FirstShown+Line]^.Mark:=FALSE;
  999.     END;
  1000.   END;
  1001.  
  1002.   PROCEDURE FilesbbsType.HatchFiles;
  1003.   VAR
  1004.     i : Integer;
  1005.     s : STRING;
  1006.   BEGIN
  1007.     BEGIN
  1008.       IF MarkCount=0 THEN FilesBBS[FirstShown+Line]^.Mark:=True;
  1009.       FOR i:=1 TO FilesBBSNum DO
  1010.         WITH FilesBBS[i]^ DO
  1011.           IF Mark AND HasFileName(Tekst^) THEN
  1012.           BEGIN
  1013.             s:=Tekst^+' ';
  1014.             Hatch(Area^[CurrentArea]^.Path^+COPY(s,1,POS(' ',s)-1),COPY(s,14,128));
  1015.           END;
  1016.       IF MarkCount=1 THEN FilesBBS[FirstShown+Line]^.Mark:=FALSE;
  1017.     END;
  1018.   END;
  1019.  
  1020.   PROCEDURE FilesbbsType.AreaManagerMain;
  1021.   VAR
  1022.     s        : String;
  1023.     i,GemNum : Integer;
  1024.     TmpFB    : FilesBBSRec;
  1025.     Ch       : Char;
  1026.     AreaNum,
  1027.     InKey    : Word;
  1028.     ReDraw   : Boolean;
  1029.     sr       : SearchRec;
  1030.   BEGIN
  1031.     BEGIN
  1032.       REPEAT
  1033.         IF (ChooseFileArea(InKey)) AND (CurrentArea<>0) THEN
  1034.         BEGIN
  1035.           BEGIN
  1036.             IF NOT Str2Word(Area^[CurrentArea]^.Tag^, AreaNum) THEN AreaNum:=0;
  1037.             FileMgrWin^.wFrame.ChangeHeaderString(0,' Area : '+Area^[CurrentArea]^.Title^+' ',ReDraw);
  1038.             IF ReDraw THEN FileMgrWin^.wFrame.UpDateFrame ELSE FileMgrWin^.wFrame.DrawHeader(0);
  1039.             MemOk:=ReadFilesInArea(Area^[CurrentArea]^.FPath^,7,
  1040.                                    Files^,FilesBBS,FilesBBSNum,NumFiles,AreaNum);
  1041.             IF MemOk THEN
  1042.             BEGIN
  1043.               IF Cfg.AreaMan.AdoptDefault THEN AdoptOrphans(True,True,FilesBBS,
  1044.                    Files^,NumFiles,FilesBBSNum,'');
  1045.               IF Cfg.AreaMan.InsDLCnt THEN InsertDownloadCounters(True);
  1046.               ShowFilesInArea(StartLine);
  1047.               Line:=1;
  1048.               REPEAT
  1049.                 Topic:=51;
  1050.               SetKbdStatProc(AreaManagerKbdStatProc);
  1051.               IF MaxL>0 THEN ShowFilesBBSLine(FilesBBS[FirstShown+Line]^,Line,True);
  1052.               InKey:=PopReadKeyWord;
  1053.               IF MaxL>0 THEN ShowFilesBBSLine(FilesBBS[FirstShown+Line]^,Line,FALSE);
  1054.               SetKbdStatProc(NoKbdStatProc);
  1055.               Ch:=Char(Lo(InKey));
  1056.               CASE ch OF
  1057.                 'a'..'z' : ch:=UpCase(ch);
  1058.                 'æ'      : ch:='Æ';
  1059.                 '¢'      : ch:='¥';
  1060.                 'å'      : ch:='Å';
  1061.               END;
  1062.               CASE Ch OF
  1063.        '0'..'9',
  1064.        'A'..'Z',
  1065.        'Æ','¥','Å' : IF MaxL>0 THEN
  1066.                      BEGIN
  1067.                        gemnum:=FirstShown+Line;
  1068.                        i:=GemNum;
  1069.                        REPEAT
  1070.                          Inc(i);
  1071.                          IF i>FilesBBSNum THEN i:=1;
  1072.                        UNTIL (GemNum=i) OR (ch=COPY(FilesBBS[i]^.Tekst^,1,1));
  1073.                        IF i<>GemNum THEN
  1074.                        BEGIN
  1075.                          IF i>8 THEN Line:=9 ELSE Line:=i;
  1076.                          FirstShown:=i-Line;
  1077.                          ShowFilesInArea(FirstShown);
  1078.                        END;
  1079.                      END;
  1080.                 #0 : BEGIN
  1081.                        s:=FilesBBS[FirstShown+Line]^.Tekst^+' ';
  1082.                        s:=Copy(s,1,pos(' ',s)-1);
  1083.                        CASE InKey OF
  1084.                          Del,
  1085.                          F2 : IF WritableFile(Area^[CurrentArea]^.FPath^) AND
  1086.                                  NOT movemode AND (MaxL>0) THEN DeleteLine(True);
  1087.                          F3 : IF WritableFile(Area^[CurrentArea]^.FPath^) AND
  1088.                                  NOT movemode AND (MaxL>0) THEN EditFileDescription;
  1089.                          F4 : IF NOT movemode AND (MaxL>0) THEN MoveLine;
  1090.                          F5 : IF WritableFile(Area^[CurrentArea]^.Path^+s) AND
  1091.                                  NOT movemode AND (MaxL>0) THEN RenameLine;
  1092.                          F6 : IF WritableFile(Area^[CurrentArea]^.Path^+s) AND
  1093.                                  NOT movemode AND (MaxL>0) THEN TouchFile;
  1094.                          Ins,
  1095.                          F7 : IF WritableFile(Area^[CurrentArea]^.FPath^) AND
  1096.                                  NOT movemode THEN InsertLine;
  1097.                          F8 : IF WritableFile(Area^[CurrentArea]^.FPath^) THEN SortFilesBBS;
  1098.                          F9 : IF NOT movemode THEN
  1099.                               BEGIN
  1100.                                 IF HasFileName(s) THEN
  1101.                                 BEGIN
  1102.                                   ViewArchive(AddBackSlash(Area^[CurrentArea]^.Path^)+s,ArcType(s));
  1103.                                   Information('');
  1104.                                   FindFirst(s,Archive,sr);
  1105.                                   i:=GetFileInfo(s,Files^,NumFiles);
  1106.                                   IF i>0 THEN
  1107.                                   BEGIN
  1108.                                     Move(sr.Time,Files^[i],21);
  1109.                                     ShowFilesBBSLine(FilesBBS[FirstShown+Line]^,Line,FALSE);
  1110.                                   END;
  1111.                                   FindClose(sr);
  1112.                                 END;
  1113.                               END;
  1114.                         F10 : IF NOT movemode THEN GlobalCommands;
  1115.                        ShF1 : SendFilesToNode;
  1116.                        ShF2 : HatchFiles;
  1117.                        ShF3 : IF (MaxL>0) AND (NOT HasFileName(FilesBBS[FirstShown+Line]^.Tekst^)) AND
  1118.                                  (WritableFile(Area^[CurrentArea]^.FPath^)) THEN
  1119.                               BEGIN
  1120.                                 s:=Trim(FilesBBS[FirstShown+Line]^.Tekst^);
  1121.                                 s:=CharStr(' ',40-(LENGTH(s) DIV 2))+s;
  1122.                                 NewStr(FilesBBS[FirstShown+Line]^.Tekst,s);
  1123.                                 ShowFilesBBSLine(FilesBBS[FirstShown+Line]^,Line,FALSE);
  1124.                               END;
  1125.                        ShF4 : IF (FirstShown+Line+1<FilesBBSNum) AND
  1126.                                  (NOT HasFileName(FilesBBS[FirstShown+Line+1]^.Tekst^)) AND
  1127.                                  (WritableFile(Area^[CurrentArea]^.FPath^)) THEN
  1128.                               BEGIN
  1129.                                 s:=Trim(FilesBBS[FirstShown+Line+1]^.Tekst^);
  1130.                                 IF LENGTH(s)<126-LENGTH(FilesBBS[FirstShown+Line]^.Tekst^) THEN
  1131.                                 BEGIN
  1132.                                   DisposeString(FilesBBS[FirstShown+Line+1]^.Tekst);
  1133.                                   NewStr(FilesBBS[FirstShown+Line]^.Tekst,FilesBBS[FirstShown+Line]^.Tekst^+' '+s);
  1134.                                   FOR i:=FirstShown+Line+1 TO FilesBBSNum-1 DO
  1135.                                     FilesBBS[i]^:=FilesBBS[i+1]^;
  1136.                                   DEC(FilesBBSNum);
  1137.                                   ShowFilesInArea(FirstShown);
  1138.                                 END;
  1139.                               END;
  1140.                         ShF9: IF NOT movemode AND (MaxL>0) THEN ViewGIF;
  1141.                         Home: IF MaxL>0 THEN
  1142.                               BEGIN
  1143.                                 IF movemode THEN
  1144.                                 BEGIN
  1145.                                   TmpFB:=FilesBBS[FirstShown+Line]^;
  1146.                                   FOR i:=FirstShown+Line DOWNTO 2 DO
  1147.                                     FilesBBS[i]^:=FilesBBS[i-1]^;
  1148.                                   FilesBBS[1]^:=TmpFB;
  1149.                                 END;
  1150.                                 ShowFilesInArea(0);
  1151.                                 Line:=1;
  1152.                               END;
  1153.                          Up : IF (MaxL>0) AND (FirstShown+Line>1) THEN
  1154.                               BEGIN
  1155.                                 IF movemode THEN
  1156.                                 BEGIN
  1157.                                   TmpFB:=FilesBBS[FirstShown+Line-1]^;
  1158.                                   FilesBBS[FirstShown+Line-1]^:=FilesBBS[FirstShown+Line]^;
  1159.                                   FilesBBS[FirstShown+Line]^:=TmpFB;
  1160.                                   IF Line>1 THEN ShowFilesBBSLine(FilesBBS[FirstShown+Line-1]^,Line-1,FALSE);
  1161.                                   ShowFilesBBSLine(FilesBBS[FirstShown+Line]^,Line,FALSE);
  1162.                                 END;
  1163.                                 IF Line>1 THEN Dec(Line) ELSE
  1164.                                   IF FirstShown>0 THEN
  1165.                                   BEGIN
  1166.                                     ScrollFilesDown;
  1167.                                     IF (MaxL<ScreenHeight-6) AND (FirstShown+Line<FilesBBSNum) THEN Inc(MaxL);
  1168.                                   END;
  1169.                               END;
  1170.                         PgUp: BEGIN
  1171.                                 IF (MaxL>0) THEN
  1172.                                 BEGIN
  1173.                                   IF movemode AND (FirstShown+Line>1) THEN
  1174.                                   BEGIN
  1175.                                     IF FirstShown+Line>ScreenHeight-7 THEN GemNum:=FirstShown+Line-(ScreenHeight-7)
  1176.                                     ELSE GemNum:=1;
  1177.                                     TmpFB:=FilesBBS[FirstShown+Line]^;
  1178.                                     FOR i:=FirstShown+Line-1 DOWNTO GemNum DO
  1179.                                       FilesBBS[i+1]^:=FilesBBS[i]^;
  1180.                                     FilesBBS[GemNum]^:=TmpFB;
  1181.                                   END;
  1182.                                   GemNum:=FirstShown;
  1183.                                   FOR i:=1 TO ScreenHeight-7 DO
  1184.                                     IF Line>1 THEN Dec(Line) ELSE
  1185.                                       IF FirstShown>0 THEN Dec(FirstShown);
  1186.                                   IF (GemNum<>FirstShown) OR movemode THEN ShowFilesInArea(FirstShown);
  1187.                                 END;
  1188.                               END;
  1189.                         EndKey: IF NOT movemode THEN
  1190.                               BEGIN
  1191.                                 i:=INTEGER(FilesBBSNum)-(ScreenHeight-6);
  1192.                                 IF i<0 THEN i:=0;
  1193.                                 ShowFilesInArea(i);
  1194.                                 Line:=MaxL;
  1195.                               END
  1196.                               ELSE
  1197.                               BEGIN
  1198.                                 TmpFB:=FilesBBS[FirstShown+Line]^;
  1199.                                 FOR i:=FirstShown+Line TO FilesBBSNum-1 DO
  1200.                                   FilesBBS[i]^:=FilesBBS[i+1]^;
  1201.                                 FilesBBS[FilesBBSNum]^:=TmpFB;
  1202.                                 i:=FilesBBSNum-(ScreenHeight-6);
  1203.                                 IF i<0 THEN i:=0;
  1204.                                 ShowFilesInArea(i);
  1205.                                 Line:=MaxL;
  1206.                               END;
  1207.                         Down: IF (MaxL>0) THEN
  1208.                               BEGIN
  1209.                                 IF movemode AND (FirstShown+Line<FilesBBSNum) THEN
  1210.                                 BEGIN
  1211.                                   TmpFB:=FilesBBS[FirstShown+Line+1]^;
  1212.                                   FilesBBS[FirstShown+Line+1]^:=FilesBBS[FirstShown+Line]^;
  1213.                                   FilesBBS[FirstShown+Line]^:=TmpFB;
  1214.                                   ShowFilesBBSLine(FilesBBS[FirstShown+Line]^,Line,FALSE);
  1215.                                   IF Line<MaxL THEN ShowFilesBBSLine(FilesBBS[FirstShown+Line+1]^,Line+1,FALSE);
  1216.                                 END;
  1217.                                 IF Line<MaxL THEN Inc(Line) ELSE
  1218.                                   IF FirstShown+Line<FilesBBSNum THEN ScrollFilesUp;
  1219.                               END;
  1220.                          PgDn: IF (MaxL>0) THEN
  1221.                               BEGIN
  1222.                                 IF movemode AND (FirstShown+Line<FilesBBSNum) THEN
  1223.                                 BEGIN
  1224.                                   IF FirstShown+Line+(ScreenHeight-7)<=FilesBBSNum THEN GemNum:=FirstShown+Line+ScreenHeight-7
  1225.                                                                                    ELSE GemNum:=FilesBBSNum;
  1226.                                   TmpFB:=FilesBBS[FirstShown+Line]^;
  1227.                                   FOR i:=FirstShown+Line TO GemNum DO
  1228.                                     FilesBBS[i]^:=FilesBBS[i+1]^;
  1229.                                   FilesBBS[GemNum]^:=TmpFB;
  1230.                                 END;
  1231.                                 GemNum:=FirstShown;
  1232.                                 FOR i:=1 TO ScreenHeight-7 DO
  1233.                                   IF Line<MaxL THEN Inc(Line) ELSE
  1234.                                     IF FirstShown+Line<FilesBBSNum THEN Inc(FirstShown);
  1235.                                 IF (GemNum<>FirstShown) OR movemode THEN ShowFilesInArea(FirstShown);
  1236.                                 Line:=MaxL;
  1237.                               END;
  1238.                        END;
  1239.                      END;
  1240.                #13 : IF MaxL>0 THEN
  1241.                      BEGIN
  1242.                        IF movemode THEN
  1243.                        BEGIN
  1244.                          movemode:=False;
  1245.                          ShowFilesInArea(FirstShown);
  1246.                          Information('');
  1247.                        END ELSE
  1248.                        BEGIN
  1249.                          FilesBBS[FirstShown+Line]^.Mark:=NOT FilesBBS[FirstShown+Line]^.Mark;
  1250.                          ShowFilesBBSLine(FilesBBS[FirstShown+Line]^,Line,FALSE);
  1251.                          MarkedHeader;
  1252.                          IF FirstShown+Line<FilesBBSNum THEN
  1253.                            IF Line<MaxL THEN Inc(Line) ELSE ScrollFilesUp;
  1254.                        END;
  1255.                      END;
  1256.                #32 : BEGIN
  1257.                        FOR i:=1 TO FilesBBSNum DO
  1258.                          FilesBBS[i]^.Mark:=FALSE;
  1259.                        ShowFilesInArea(FirstShown);
  1260.                      END;
  1261.                 END;
  1262.               UNTIL (InKey=Esc) AND NOT movemode;
  1263.               InKey:=0;
  1264.               WriteCurrentFilesBBS(Area^[CurrentArea]^.FPath^,FilesBBSNum,FilesBBS,True);
  1265.             END ELSE
  1266.             BEGIN
  1267.               DeAllocateFiles(FilesBBS,FilesBBSNum);
  1268.               AskError(8,'Insufficient memory to enter this area',3);
  1269.             END;
  1270.         END;
  1271.       END;
  1272.       UNTIL InKey=Esc;
  1273.     END;
  1274.   END;
  1275.  
  1276. END.
  1277.